﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved All Rights Reserved All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using System.Xml;

namespace FinPlusAssembler
{
    public static class XmlExtension
    {
        public static string Parse(this XmlElement element, string name, string defaultValue = "")
        {
            XmlNode n = element.Attributes[name];
            if (n == null)
                return defaultValue;
            return n.Value;
        }

        public static XmlAttribute Attribute(this XmlDocument doc, string name, string value)
        {
            var attribute = doc.CreateAttribute(name);
            attribute.Value = value;

            return attribute;
        }
    }
}
